package activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentPagerAdapter
import com.wd.common.base.BaseActivity
import com.wd.rim.R
import com.wd.rim.databinding.ActivityZhuanBinding
import com.wd.rim.databinding.ActivityZoneBinding
import com.wd.rim.fragment.JoinPostFragment
import com.wd.rim.fragment.JoinVideoFragment
import com.wd.rim.fragment.QuestionsFragment
import com.wd.rim.fragment.SquareFragment

class ZoneActivity : BaseActivity<ActivityZoneBinding, Any?>()  {
    private val title= arrayOf("帖子","视频")
    override fun getViewBinding()=ActivityZoneBinding.inflate(layoutInflater)

    override fun initData() {
        val list=ArrayList<Fragment>()
        list.add(JoinPostFragment())
        list.add(JoinVideoFragment())
        binding.joinpager.offscreenPageLimit=1
        binding.joinpager.setAdapter(object : FragmentPagerAdapter(supportFragmentManager) {
            override fun getItem(position: Int): Fragment {
                return list[position]
            }

            override fun getCount(): Int {
                return list.size
            }

            override fun getPageTitle(position: Int): CharSequence? {
                return title[position]
            }
        })
        binding.jointab.setupWithViewPager(binding.joinpager)
        binding.jointab.setSelectedTabIndicatorColor(resources.getColor(com.squareup.leakcanary.core.R.color.leak_canary_yellow))

    }


}